/* 
 * index javascript 
 * @author luweijun
 */
function siteGuid() 
{  	
        show_iframe_win('/admin/umams/guide/?', '', 732, 503);
}

function getV()
{
        var curvn = "UMAMS_v1.3";
        var vn = "";
        var txt = "<a href=\"javascript:void(0);\" onclick=\"autoupgrade()\"><font color=\"#FF0000\">单击这里升级</font></a>";
        $('.newvn').empty().html(vn);
        if( curvn >= vn.toString() ) {
                txt = "<font color=\"#FF0000\">当前已是最新版本，不需要升级！</font>";
        }
        $('.upgrade').empty().html(txt);
}

function autoupgrade() {
        $(".upgrade").html("升级中……");
        _ajax_request('frontpage', 'auto_upgrade', '', onsuccess, onfailed);
}

function onsuccess(response) {
        var o_result = _eval_json(response);

        if (!o_result) {
                return onfailed(response);
        }

        if (o_result.result == "ERROR") {
                $(".upgrade").html(o_result.errmsg);
                return false;
        } else if (o_result.result == "OK") {
                $(".upgrade").html("升级成功！");
                reloadPage();
        } else {
                return onfailed(response);
        }
}

function onfailed(response) {
        var retry = "<a href=\"javascript:void(0);\" onclick=\"autoupgrade()\"><font color=\"#FF0000\">重试</font></a>";
        $(".upgrade").html("请求失败！&nbsp;&nbsp;" + retry);
        return false;
}


